﻿using DJY.Domain.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DJY.Domain.ViewModel.WorkFlow
{
    /// <summary>
    /// 处理节点消息结果
    /// </summary>
    public class ProcessMsgResult
    {
        /// <summary>
        /// 处理信息
        /// </summary>
        public string msg { get; set; }

        /// <summary>
        /// 成功还是失败消息
        /// </summary>
        public bool state { get; set; }

        /// <summary>
        /// 当前节点
        /// </summary>
        public WorkFlowNode node { get; set; }

        /// <summary>
        /// 返回成功
        /// </summary>
        /// <param name="msg">成功消息</param>
        /// <returns></returns>
        public static ProcessMsgResult Ok(WorkFlowNode node, string msg = null)
        {
            return new ProcessMsgResult() { state = true, node = node, msg = msg };
        }

        /// <summary>
        /// 返回失败
        /// </summary>
        /// <param name="msg">失败消息</param>
        /// <returns></returns>
        public static ProcessMsgResult Fail(string msg = null)
        {
            return new ProcessMsgResult() { state = false, msg = msg };
        }
    }
}
